package com.nbgs.demo.dao;

import com.nbgs.demo.info.PartConsumptionInfo;
import com.nbgs.demo.info.PartInsertConsumptionInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface AutoGenerateInfoMapper {

    @Select("SELECT consumption_month,consumption_end,card_id FROM  " +
            "(SELECT *  FROM `t_consumption` " +
            "order by t_consumption.consumption_id DESC) a " +
            "GROUP BY a.card_id")
    List<PartConsumptionInfo> selectPartInfo();

    @Insert("insert into t_consumption (consumption_month,consumption_start,card_id) " +
            "values (#{consumptionMonth},#{consumptionStart},#{cardId})")
    void autoGenerateInfo(PartInsertConsumptionInfo partInsertConsumptionInfo);
}
